package com.rzz.overalldemo.common;


/**
 * 公共返回对象
 *
 * @author rzz
 * @since 1.0.0
 */

public class RespBean {

	private Integer code;

	private String message;

	private Object obj;

	public RespBean() {
	}

	public RespBean(Integer code, String message, Object obj) {
		this.code = code;
		this.message = message;
		this.obj = obj;
	}

	/**
	 * 成功返回方法
	 * @param message
	 * @return
	 */
	public static RespBean success(String message){
		return new RespBean(200,message,null);
	}

	/**
	 * 成功返回方法
	 * @param message
	 * @return
	 */
	public static RespBean success(String message,Object obj){
		return new RespBean(200,message,obj);
	}


	/**
	 * 失败返回方法
	 * @param message
	 * @return
	 */
	public static RespBean error(String message){
		return new RespBean(500,message,null);
	}

	/**
	 * 失败返回方法
	 * @param message
	 * @return
	 */
	public static RespBean error(String message,Object obj){
		return new RespBean(500,message,obj);
	}

	public Integer getCode() {
		return code;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getObj() {
		return obj;
	}

	public void setObj(Object obj) {
		this.obj = obj;
	}

	@Override
	public String toString() {
		return "RespBean{" +
				"code=" + code +
				", message='" + message + '\'' +
				", obj=" + obj +
				'}';
	}
}